package leetcode_双周赛._20210501;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/5/1 22:32
 * 将所有数字用字符替换
 */
public class _5730 {
    public static void main(String[] args) {
        System.out.println(new _5730().replaceDigits("a1c1e1"));
    }

    public String replaceDigits(String s) {
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if (i % 2 == 0) ans.append(s.charAt(i));
            else ans.append(shift(s.charAt(i - 1), Integer.parseInt(s.charAt(i) + "")));
        }
        return ans.toString();
    }
    public char shift(char c, int i) {
        char n = (char)(c + i);
        if (n > 'z') n -= 26;
        return n;
    }
}
